
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.datadump.biz.convertor.*;
import com.joysuch.wwyt.datadump.biz.processor.EduCertificateUserProcessor;
import com.joysuch.wwyt.datadump.biz.query.EduCertificateDumpQueryBean;
import com.joysuch.wwyt.edu.entity.dsl.QEduCertificate;
import com.joysuch.wwyt.edu.entity.dsl.QEduCertificateUser;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 持证管理
 *
 * @since
 *
 */
@DataDumpEntity(name = "edu-certificate-user-dump", entity = QEduCertificateUser.class,
        exportQueryConditions = EduCertificateDumpQueryBean.class,
        businessName = "持证管理", importProcessors = EduCertificateUserProcessor.class)
@Data
public class EduCertificateUserDumpBean {

    @NotNull
    @Excel(name = "工号/承包商人员编号", width = 20)
    @DataDumpField(field = "userId", exportConvertors = ExportEduCertificateUserInfoConvertor.class, exportConvertorParams = "code", importIgnore = true)
    private String userCode;

    @NotNull
    @Excel(name = "姓名", width = 15)
    @DataDumpField(field = "userId", exportConvertors = ExportEduCertificateUserInfoConvertor.class, exportConvertorParams = "name", importIgnore = true)
    private String userName;

    @NotNull
    @Pattern(regexp = "是|否", message = "只能填写以下内容" + "\"是|否\"")
    @Excel(name = "是否是承包商人员", width = 15)
    @DataDumpField(field = "userContractorFlag", exportConvertors = ExportYesNoConvertor.class, importConvertors = ImportYesNoToNumberConvertor.class)
    private String userContractorFlag;

    @NotNull
    @Excel(name = "证书名称", width = 30)
    @DataDumpField(field = "certId", referenceEntity = QEduCertificate.class, referenceEntityField = "name", importKey = true)
//    @DataDumpField(field = "certId", referenceEntity = QEduCertificate.class, referenceEntityField = "certTypeId",
//            exportConvertors = ExportBaseTypeGroupItemNameConvertor.class, importKey = true)
    private String certTypeName;

    @NotNull
    @Excel(name = "证书编号", width = 22)
    @DataDumpField(field = "certNo", importKey = true)
    private String certNo;

    @Excel(name = "证书等级", width = 15)
    @DataDumpField(field = "cartificateLevel")
    private String cartificateLevel;

    @Excel(name = "有效期开始时间", width = 20, importFormat = "yyyy-MM-dd")
    @DataDumpField(field = "takenTime", exportConvertors = DateToStringConvertor.class, importConvertors = StringToDateConvertor.class)
    private String takenTime;

    @Excel(name = "有效期结束时间", width = 20, importFormat = "yyyy-MM-dd")
    @DataDumpField(field = "outOfDateTime", exportConvertors = DateToStringConvertor.class, importConvertors = DateCompareToConvertor.class)
    private String outOfDateTime;

    @Excel(name = "复证日期", width = 20)
    @DataDumpField(field = "repeatViewDateDime", exportConvertors = DateToStringConvertor.class, importConvertors = StringToDateConvertor.class)
    private String repeatViewDateDime;

    @Excel(name = "发证机关", width = 20)
    @DataDumpField(field = "licenseIssuingAgencies")
    private String licenseIssuingAgencies;

    @Excel(name = "证书存放地", width = 20)
    @DataDumpField(field = "licenseSavingArea")
    private String licenseSavingArea;

    @Excel(name = "备注", width = 20)
    @DataDumpField(field = "remark")
    private String remark;
}
